<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<meta name="viewport" content="width=1000, initial-scale=1.0, maximum-scale=1.0">
		<script type="text/javascript" src="<?php echo __PUBLIC__?>/jquery-1.8.2.min.js"></script>
	    <!-- Loading Bootstrap -->
	    <link href="<?php echo __PUBLIC__?>/Flat/dist/css/vendor/bootstrap.min.css" rel="stylesheet">
	    <!-- Loading Flat UI -->
	    <link href="<?php echo __PUBLIC__?>/assets/global/plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css"/>
		<link href="<?php echo __PUBLIC__?>/assets/global/plugins/simple-line-icons/simple-line-icons.min.css" rel="stylesheet" type="text/css"/>
		<link href="<?php echo __PUBLIC__?>/assets/global/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css"/>
		<link rel="stylesheet" href="<?php echo __PUBLIC__?>/hdjs/hdjs.css">
		<script type="text/javascript" src="<?php echo __PUBLIC__?>/hdjs/hdjs.min.js"></script>
		<!-- 新 Bootstrap 核心 CSS 文件 -->
		<link rel="stylesheet" href="//cdn.bootcss.com/bootstrap/3.3.5/css/bootstrap.min.css">
		<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
		<script src="//cdn.bootcss.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
	    <!-- HTML5 shim, for IE6-8 support of HTML5 elements. All other JS at the end of file. -->
	    <!--[if lt IE 9]>
	      <script src="dist/js/vendor/html5shiv.js"></script>
	      <script src="dist/js/vendor/respond.min.js"></script>
	    <![endif]-->
	</head>
	<body>
		<table class="table table-hover">
			<tr class="active">
			  <th width="30">uid</th>
			  <th>用户名称</th>
			  <th>姓名</th>
	          <th>上次登录ip</th>
	          <th>上次登录时间</th>
	          <th>职位</th>
	          <th>状态</th>
			  <th width="210">操作</th>
			</tr>
			<?php foreach ($data as $k=>$v){?>
				<tr>
					<td><?php echo $v['uid']?></td>
					<td><?php echo $v['username']?></td>
					<td><?php echo $v['nickname']?></td>
					<td><?php echo $v['login_ip']?></td>
					<td><?php echo date('Y-m-d H:i',$v['login_time'])?></td>
					<td><?php echo $v['class']?></td>
					<td><i <?php if($v['statu']==0){?>
                
							class="glyphicon glyphicon-ok"
						<?php }else if($v['statu']==1){?>
							class="glyphicon glyphicon-remove"
						
               <?php }?>
					></i></td>
					<td>
						<?php if($v['statu']==0){?>
                
							<a href="javascript:;" class="btn btn-sm btn-danger lock" uid="<?php echo $v['uid']?>">锁定</a>
						<?php }else{?>
							<a href="javascript:;" class="btn btn-sm btn-primary unlock" uid="<?php echo $v['uid']?>">解锁</a>
						
               <?php }?>
						<a href="<?php echo U('editUser',array('uid'=>$v['uid']))?>" class="btn btn-sm btn-warning">编辑</a>
						<!-- <a href="" class="btn btn-sm btn-danger">删除</a> -->
					</td>
				</tr>
			<?php }?>
		</table>
	 <ul class="pagination">
	    <?php echo $page?>
	 </ul>
	</body>
<script type="text/javascript">
	$('.lock').live('click',function(){
		obj=$(this);
		uid=obj.attr('uid');
		// pobj=obj.parent();
		$.ajax({
			url:'<?php echo U("lockUser")?>',
			type:'post',
			data:{uid:uid},
			dataType:'json',
			success:function(data){
				// alert(data)
				if(data.statu==1){
					hd_alert_test('锁定成功');
					/*pobj.prepend('<a href="javascript:;" uid='+uid+' class="btn btn-sm btn-primary">解锁</a>');
					obj.remove();*/
				}
			}
		})
	})
	$('.unlock').live('click',function(){
		obj=$(this);
		uid=obj.attr('uid');
		$.ajax({
			url:'<?php echo U("unLockUser")?>',
			type:'post',
			data:{uid:uid},
			dataType:'json',
			success:function(data){
				// alert(data)
				if(data.statu==1){
					hd_alert_test('解锁成功');
				}
			}
		})
	})
    //气泡提示信息实例
    function hd_alert_test(msg) {
        hd_alert({
            message: msg,//显示内容
            timeout: 1,//显示时间
            success: function () {//这是回调函数
            	location.reload();
            }
        })
    }
</script>
</html>
